import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']  # 解决中文乱码问题
plt.rcParams['axes.unicode_minus'] = False

# 日期
dates = list(range(1, 16))

# 最低温和最高温数据
min_temps = [22, 23, 24, 25, 24, 25, 24, 23, 22, 23, 24, 25, 24, 23, 22]
max_temps = [29, 30, 31, 32, 33, 34, 31, 30, 29, 30, 32, 33, 31, 30, 29]

precipitation = [3.2, 5.1, 0.0, 0.5, 8.7, 15.4, 12.3, 2.1, 0.0, 1.2, 6.8, 20.1, 7.5, 3.0, 0.2]

plt.figure(figsize=(10, 6))
plt.plot(dates, min_temps, label='最低气温', color='blue')
plt.plot(dates, max_temps, label='最高气温', color='red')
plt.bar(dates, precipitation, label='降水量', color='green', alpha=0.5)
plt.xlabel('日期')
plt.ylabel('值')
plt.title('清远市未来15天的气温和降水量')
plt.legend()
plt.grid(True)
plt.show()